<template>
	<view>
		<view class="title">
			{{item.title}}
		</view>
		<view class="author">
			{{item.author}}---{{item.date}}
		</view>
		<u-parse :content="conData" class="content" @preview="preview" @navigate="navigate"></u-parse>
		<countDwon :bdid="item.id" :time="item.time"/>
		<collect :bdid="item.id"/>
	</view>
</template>

<script>
	import marked from 'marked'
	import uParse from '../../common/u-parse/components/u-parse/u-parse.vue';
	import countDwon from '../countDown/countDown.vue'
	import collect from '../collect/collect.vue'
	export default {
		components: {
			uParse,
			countDwon,
			collect
		},
		data() {
			return {
				id: 0,
				item: {},
				conData:''
			}
		},
		onLoad(ids) {
			this.id = ids.id
			console.log(ids.id)
			this.getItem()
		},
		methods: {
			preview(src, e) {
				// do something
			},
			navigate(href, e) {
				// do something
			},
			//获取数据
			getItem() {
				uni.request({
					url: 'http://localhost:3030/msbd/getlist',
					method: 'get',
					data: {
						id: this.id
					},
					success: (res) => {
						this.item = res.data.data
						this.conData=marked(`${this.item.content}`)
						
						console.log(res.data.data)
					}
				})
			}
		}
	}
</script>

<style>
	@import url("../../common/u-parse/components/u-parse/u-parse.css");
	.title {
		font-size: 25px;
		font-weight: 700;
		margin: 10px 0 10px 15px;
	}

	.author {
		font-size: 14px;
		color: gray;
		text-align: right;
		padding-right: 15px;
	}

	.content {
		width: 95%;
		margin: 0 15px;
	}
</style>
